package com.wxzz.elearing.user.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wxzz.elearing.user.entity.AdminPermission;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author
 * @since 2021-03-11
 */
public interface AdminPermissionMapper extends BaseMapper<AdminPermission> {

    /**
     * 查询一级菜单栏权限
     * @param permissionType
     * @return
     */
    @Select("SELECT * FROM  admin_permission WHERE permission_type = #{permissionType} AND pid = 0 AND deleted = 0 ORDER BY sort ASC")
    List<AdminPermission> listAdminPermissions(@Param("permissionType") Integer permissionType);

    /**
     * 查询子集权限
     * @param pid
     * @return
     */
    @Select("SELECT * FROM  admin_permission WHERE pid = #{pid} AND deleted = 0 ORDER BY sort ASC")
    List<AdminPermission> selectAdminPermissionByPid(@Param("pid") Long pid);

}
